<template>
  <div class="shop-car">
    <nav-bar class="nav-bar">
      <template #nav-center>购物车（{{count}}）</template>
    </nav-bar>
    <scroll class="scroll" ref="scroll">
      <cart-list></cart-list>      
    </scroll>
    <cart-bottom-bar></cart-bottom-bar>
  </div>
</template>

<script>
import NavBar from '@/components/common/navbar/NavBar';
import Scroll from '@/components/common/scroll/Scroll';

import CartList from './childcomp/CartList'
import CartBottomBar from './childcomp/CartBottomBar'

export default {
  components: {
    NavBar,
    Scroll,
    CartList,
    CartBottomBar
  },
  computed: {
    count() {
      return this.$store.state.cartList.length;
    }
  },
  activated() {
    this.$refs.scroll.refresh();
  }
}
</script>

<style scoped>
.shop-car {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.scroll {
  height: calc(100vh - 44px - 49px - 40px);
}

.nav-bar {
  position: relative;
  background-color: deeppink;
  color: #fff;
  z-index: 9;
}
</style>